package com.project.service.ZLGLService.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.project.bean.SupplierBean;
import com.project.mapper.ZLGLmapper.ISupperMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;


@Service
@Transactional
public class SupperServiceImpl implements com.project.service.ZLGLService.ISupperService {
  @Autowired
  private ISupperMapper mapper;
    @Override
    public void add(SupplierBean supplier) {
        mapper.add(supplier);
    }

    @Override
    public void update(int id,String incharge, String tel) {
        mapper.update(id,incharge,tel);
    }

    @Override
    public SupplierBean findById(int id) {
       return  mapper.findById(id);
    }

    @Override
    public PageInfo<SupplierBean> cutAllByItem(int pageNO, String name, String scope) {
        PageHelper.startPage(pageNO, com.project.service.ZLGLService.ICustomerService.PAGESIZE);
        PageInfo<SupplierBean> pageInfo =  PageInfo.of(mapper.cutAllByItem(name,scope));
        return pageInfo;
    }

    @Override
    public List<SupplierBean> findAll() {
        return mapper.findAll();
    }
}
